<?php echo $this->render('layouts/__header.phtml'); ?>
<?php echo $this->render('layouts/__nav.phtml'); ?>
<script type="text/javascript" src="/js/calendar/calendar.js"></script>
<script type="text/javascript" src="/js/calendar/lang/calendar-en.js"></script>
<script type="text/javascript" src="/js/calendar/calendar-setup.js"></script>
<style type="text/css">@import url(/js/calendar/calendar.css); </style>
<script type="text/javascript" src="/js/rpt/swfobject.js"></script>
<script type="text/javascript">
window.addEvent('domready', function(){	
	Calendar.setup({inputField:"date_start",ifFormat:"%Y-%m-%d",button:"calendarBeginButton",singleClick:true,step:1});
	Calendar.setup({inputField:"date_start",ifFormat:"%Y-%m-%d",button:"vBeginDate",singleClick:true,step:1});	
	changeData();
	new Tips($$('.Tips_proc'));
});	

function changeData(){		
	var request_uri = '/report/rptdata/rpt/userscd/dates/'+$('date_start').value+'/show/list';
	var flash_data_uri = '/report/rptdata/rpt/userscd/dates/'+$('date_start').value;
	
	$('loadingbox').setStyle('display', 'block');	
	new Ajax(request_uri, {
		method: 'get',
		evalScripts : true,		
		update: $('listing'),
		onComplete: function(){
			$('loadingbox').setStyle('display', 'none');			
			$('listing').setStyle('display', 'block');
			setData(flash_data_uri);
		}
	}).request();
}

function setData(request_uri) {
 	  var flashMovie;
 	  flashMovie = document.getElementById("amxy");
      if (flashMovie) {      
	      new Ajax(request_uri, {
			method: 'get',
			evalScripts : true,		
			onComplete: function(){						
				flashMovie.setData(this.response.text);
				
			}
		}).request(); 
      }
}
</script>

<div style="text-align:right;padding-right:50px;width:100%;">Weekly Report | Daily Report</div>

<div style="margin:10px 0;">
<h2>Select date range for the report:</h2>
<span class="left" style="padding-right:20px;">Start Date &nbsp;&nbsp;
<input id="date_start" name="date_start" value="<?php if (isset($this->task['date_start'])) echo $this->task['date_start']; else echo date("Y-m-d"); ?>" style="width: 80px;" type="text" readonly />
<input type="button" id="calendarBeginButton" class="cal" style="width:20px" />
</span>
&nbsp;&nbsp;
<input type="button" value="check report!" onClick="changeData()">
</div>

<!-- amxy script-->
	<div id="flashcontent">
		<strong>You need to upgrade your Flash Player</strong>
	</div>

	<script type="text/javascript">
		// <![CDATA[		
		var so = new SWFObject("/js/rpt/amcolumn.swf", "amxy", "620", "460", "8", "#FFFFFF");
		so.addVariable("path", "/js/rpt/");
		so.addVariable("settings_file", escape("/report/rptsettings/rpt/userscd/"));
		so.addVariable("data_file", escape("/report/rptdata/rpt/userscd/"));
		so.addVariable("preloader_color", "#999999");
		so.addParam("wmode", "transparent");
		so.write("flashcontent");		
		// ]]>
	</script>
<!-- end of amxy script -->

<h2>Task Listing:</h2>
<div id="listing" style="display:none;">


</div>
<div id="loadingbox" style="display:none;padding:2px 0px 0px 8px;width:125px;height:20px;text-align:center;position:absolute;top:0px;right:0px;background:#CC0000;color:#fff;z-index:10000;"><b>Loading ...</b></div>
<?php echo $this->render('layouts/__footer.phtml'); ?>